/**
 * 
 */
package com.jmail.sample;

import org.eclipse.swt.widgets.Display;

import com.jmail.model.entity.User;

/**
 * @author huanpham
 *
 */
public class Application {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			Display display = Display.getDefault();
			User loginedUser = null;
			
			Login shell = new Login(display);
			loginedUser = (User) shell.openDialog();

			if (loginedUser != null) {
				MailViewer mailViewer = new MailViewer(display);
				mailViewer.setLoginedUser(loginedUser);
				mailViewer.open();
				mailViewer.layout();
				while (!mailViewer.isDisposed()) {
					if (!display.readAndDispatch()) {
						display.sleep();
					}
				}
			} else {
				System.out.println("Login failed!");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
